<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
  <!--不推荐的位置-->
<body>


  <h2 class="title">hahaha</h2>
  <p></p>

  <div class="box">
    <a href="#"></a>
  </div>

<!--推荐的位置-->
  <script>
  
    alert("Hello World")
    document.querySelector(".title").onclick = function(){
      alert("点击了h2元素")
      
    }
    /**
    函数文档注释
    */
    function test(){

    }
    test

  </script>

</body>

</html>